package co.edu.usbcali.prototipobeta.modelo.dto;

import co.edu.usbcali.prototipobeta.modelo.Rol;
import co.edu.usbcali.prototipobeta.presentation.backingBeans.RolView;

import java.io.Serializable;

import java.util.Date;

import javax.faces.event.ActionEvent;


/**
*
*
* @author Zathura Code Generator http://code.google.com/p/zathura
*
*/
public class RolDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    private String rolNombre;
    private String rolId;
    private boolean rowSelected = false;
    private RolView rolView;
    private Rol rol;

    public Rol getRol() {
        return rol;
    }

    public String listener_update(ActionEvent e) {
        try {
            rolView.action_modifyWitDTO(((rolId == null) || rolId.equals(""))
                ? null : new Long(rolId),
                ((rolNombre == null) || rolNombre.equals("")) ? null
                                                              : new String(
                    rolNombre));
            rowSelected = !rowSelected;
        } catch (Exception ex) {
            return "";
        }

        return "";
    }

    public void listener_cancel(ActionEvent e) {
        rolId = rol.getRolId().toString();
        rolNombre = (rol.getRolNombre() != null)
            ? rol.getRolNombre().toString() : null;
        rowSelected = !rowSelected;
    }

    /**
    * <p>Bound to commandLink actionListener in the ui that renders/unrenders
        * the Object details for editing.</p>
        */
    public void toggleSelected(ActionEvent e) {
        rolId = rol.getRolId().toString();
        rolNombre = (rol.getRolNombre() != null)
            ? rol.getRolNombre().toString() : null;
        rowSelected = !rowSelected;
    }

    public void setRol(Rol rol) {
        this.rol = rol;
    }

    public RolView getRolView() {
        return rolView;
    }

    public void setRolView(RolView rolView) {
        this.rolView = rolView;
    }

    public String getRolNombre() {
        return rolNombre;
    }

    public void setRolNombre(String rolNombre) {
        this.rolNombre = rolNombre;
    }

    public String getRolId() {
        return rolId;
    }

    public void setRolId(String rolId) {
        this.rolId = rolId;
    }

    public boolean isRowSelected() {
        return rowSelected;
    }

    public void setRowSelected(boolean rowSelected) {
        this.rowSelected = rowSelected;
    }
}
